<template>
  <div v-if="info">
    <div class="topBox">
      <nav class="nav">
        <span class="back" @click="$router.go(-1)">&lt;</span>
      </nav>
      <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
        <van-swipe-item>1</van-swipe-item>
        <van-swipe-item>2</van-swipe-item>
        <van-swipe-item>3</van-swipe-item>
        <van-swipe-item>4</van-swipe-item>
      </van-swipe>

      <div>
        <div class="content">
          <h3>{{ info.title }}</h3>
          <p class="subway">近地铁</p>
        </div>
      </div>

      <div class="detail">
        <div>
          <i>21/月</i>
          <p>租金</p>
        </div>
        <div>
          <i>四室+</i>
          <p>房型</p>
        </div>
        <div>
          <i>12平米</i>
          <p>面积</p>
        </div>
      </div>

      <div class="bottom">
        <div class="left">
          <div><span>装修: </span><i> 精装</i></div>
          <div><span>楼层: </span><i>中楼层</i></div>
        </div>
        <div class="right">
          <div><span>朝向: </span><i>西</i></div>
          <div><span>类型: </span><i>普通住宅</i></div>
        </div>
      </div>
    </div>

    <div class="matching">
      <h5>房屋配套</h5>
      <div class="getMathching">
        <div>
          <span>衣柜</span>
          <span>衣柜</span>
          <span>衣柜</span>
        </div>
      </div>
    </div>

    <footer class="toolbar">
      <a href="#">收藏</a>
      <a href="#">在线问答</a>
      <a href="#">在线预约</a>
    </footer>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: 'Content',
  data() {
    return {
      info: null,
    }
  },

  async created() {
    const { data } = await axios({
      url: 'http://liufusong.top:8080/houses',
      data: {
        cityId: 'AREA%7Cdbf46d32-7e76-1196',
        stat: '1',
        end: '10',
      },
    })
    console.log(data)
    this.info = data.body.list
  },
}
</script>

<style scoped lang="less">
.nav {
  height: 44px;
  border-bottom: 1px solid #e4e4e4;
  line-height: 44px;
  text-align: center;
}
.back {
  font-size: 18px;
  color: #666;
  position: absolute;
  left: 10px;
  top: 0;
  transform: scale(1, 1.5);
}
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 150px;
  text-align: center;
  background-color: #39a9ed;
}
h3 {
  padding-left: 5px;
}
.subway {
  margin-left: 5px;
  width: 40px;
  color: #39becd;
  background: #e1f5f8;
  font-size: 12px;
  text-align: center;
  border-radius: 3px;
}
.toolbar {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 60px;
  background-color: #21b97a;
  display: flex;
  justify-content: space-around;
  align-items: center;
  a {
    color: #fff;
    font-size: 17px;
    display: flex;
    // 主轴方向
    flex-direction: column;
    align-items: center;
  }
}

.detail {
  display: flex;
  border-top: 1px solid #cecece;
  border-bottom: 1px solid #cecece;
  margin: 0 10px;
  justify-content: space-around;
  padding-top: 10px;
  i {
    font-style: normal;
    font-size: 20px;
    font-weight: bold;
    color: red;
  }
  p {
    padding-left: 11px;
    font-size: 14px;
    color: #999;
  }
}

.bottom {
  display: flex;

  .left {
    flex: 1;
    margin: 0 10px;
    margin-top: 20px;
    span {
      color: #999;
      font-size: 13px;
    }
    i {
      font-style: normal;
      font-size: 13px;
    }
    p {
      color: #999;
      font-size: 13px;
    }
  }
  .right {
    flex: 1;
    margin: 0 10px;
    margin-top: 20px;
    span {
      color: #999;
      font-size: 13px;
    }
    i {
      font-style: normal;
      font-size: 13px;
    }
    p {
      font-size: 13px;
    }
  }
}
.getMathching {
  border-top: 1px solid #cecece;
}
</style>
